package com.ocean.web.controller.index;

import com.ocean.common.core.domain.AjaxResult;
import com.ocean.inxex.service.StatisticsService;
import com.ocean.inxex.vo.StatistisVo;
import com.ocean.inxex.vo.oNotice;
import com.ocean.productDict.service.ONCfilemeunService;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.stereotype.Controller;
import org.springframework.web.bind.annotation.GetMapping;
import org.springframework.web.bind.annotation.PostMapping;
import org.springframework.web.bind.annotation.RequestMapping;
import org.springframework.web.bind.annotation.ResponseBody;

import java.util.List;

/**
 * 统计
 */
@Controller
@RequestMapping("/home")
public class StatisticsController {

    @Autowired
    private StatisticsService statisticsService;
    @Autowired
    private ONCfilemeunService onCfilemeunService;

    private String prefix = "index";

    /**
     * 跳转到统计地图
     * @return
     */
    @GetMapping("/statistics/map")
    public String map()
    {
        return prefix + "/statistics/map";
    }

    /**
     * 跳转到首页统计地图
     * @return
     */
    @GetMapping("/statistics/xztjmap")
    public String xztjmap()
    {
        return prefix + "/statistics/xztjmap";
    }

    /**
     * 跳转到柱形图统计
     * @return
     */
    @GetMapping("/statistics/histogram")
    public String histogram()
    {
        return prefix + "/statistics/histogram";
    }
    @GetMapping("/statistics/histogramqd")
    public String histogramqd()
    {
        return prefix + "/statistics/histogramqd";
    }


    /**
     * 跳转到产品统计页面
     * @return
     */
    @GetMapping("/statistics")
    public String statistics()
    {
        return prefix + "/statistics/statistics";
    }
    /**
     * 查询总下载量
     */
    @PostMapping("/getnumall")
    @ResponseBody
    public AjaxResult getnumAll()
    {
        int numall = statisticsService.getNumAll();
        return AjaxResult.success(numall);
    }

    /**
     * 获取统计数据
     * @return
     */
    @PostMapping("/getstatistis")
    @ResponseBody
    public AjaxResult getstatistis(String type)
    {
        List<StatistisVo> statistisVo = statisticsService.getstatistis(type);
        return AjaxResult.success(statistisVo);
    }

    @PostMapping("/getstatistiscp")
    @ResponseBody
    public AjaxResult getstatistiscp()
    {
        List<StatistisVo> statistisVo = statisticsService.getstatistiscp();
        return AjaxResult.success(statistisVo);
    }

}
